/*
 * Ext JS Library 3.1.0
 * Copyright 2009-2010 iThink Team
 * lingtianlan
 * 2010-4-6
 */
 //alert('load..');
 Ext.ux.Question = Ext.extend(Ext.BoxComponent, {
    qType:0,    // 0 单选题 1 多选题 2 填空题
	order:1,    // 题序号
	qId:0,      // 题目ID
	qTitle:'题目',   // 题干
	qBody:[{Label:'test:A',Content:'test:Content'}],    // 选项
	tplChoice: new Ext.Template("<li class='x-question-choice'><input type='{0}' name='{1}' value='{2}'/>","{3}.{4}</li>"),
	tplFillBlank:'',
	onRender: function() {
        Ext.ux.Question.superclass.onRender.apply(this, arguments);
		Ext.DomHelper.append(this.el, {html:'<div>'+this.order+ '.' + this.qTitle +'</div>', cls: 'x-question-title'});
		var choicePad = Ext.DomHelper.append(this.el, {tag: 'ul', cls: 'x-question-pad'});
		
		// 单选题的情况
		if(this.qType==0){
			for(var i=0; i<this.qBody.length; i++){
				this.tplChoice.append(choicePad,['radio',this.qId, this.qBody[i].Label, this.qBody[i].Label, this.qBody[i].Content]);
			}
		}
		
		// 多选题的情况
		if(this.qType==1){
			for(var i=0; i<this.qBody.length; i++){
				this.tplChoice.append(choicePad,['checkbox',this.qId, this.qBody[i].Label, this.qBody[i].Label, this.qBody[i].Content]);
			}	
		}
	}
	
	
});